package com.tjresearch.controller;

import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.AsyncRestTemplate;

import com.tjresearch.service.SpringTestService;

@RestController
public class SpringTestController extends AsyncRestTemplate{
	@Autowired
	private Optional<SpringTestService> springTestService;
	@RequestMapping(value = "/test")
	public String test(){
		for(int i = 0;i<5;i++){
			try {
				Thread.sleep(1000L);
				System.out.println(i);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return springTestService.get().test();
		
	}
	
}
